{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4e15d022",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import pymysql"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a41e5ab1",
   "metadata": {},
   "outputs": [],
   "source": [
    "conn = pymysql.connect(user='root',password='123456',database='student',host='master',port=3306)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "cd49d76f",
   "metadata": {},
   "outputs": [],
   "source": [
    "cursor = conn.cursor()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "c780e474",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cursor.execute(\"select * from student limit 10\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "870f3c92",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1500100001, '施笑槐', 22, '女', '文科六班', datetime.datetime(2021, 10, 19, 16, 48, 40))\n",
      "(1500100002, '吕金鹏', 24, '男', '文科六班', datetime.datetime(2021, 10, 19, 16, 48, 40))\n",
      "(1500100003, '单乐蕊', 22, '女', '理科六班', datetime.datetime(2021, 10, 19, 16, 48, 40))\n",
      "(1500100004, '葛德曜', 25, '男', '理科三班', datetime.datetime(2021, 10, 19, 16, 48, 40))\n",
      "(1500100005, '宣谷芹', 22, '女', '理科五班', datetime.datetime(2021, 10, 19, 16, 48, 40))\n",
      "(1500100006, '边昂雄', 21, '男', '理科二班', datetime.datetime(2021, 10, 19, 16, 48, 40))\n",
      "(1500100007, '尚孤风', 23, '女', '文科六班', datetime.datetime(2021, 10, 19, 16, 48, 40))\n",
      "(1500100008, '符半双', 22, '女', '理科六班', datetime.datetime(2021, 10, 19, 16, 48, 40))\n",
      "(1500100009, '沈德昌', 21, '男', '理科一班', datetime.datetime(2021, 10, 19, 16, 48, 40))\n",
      "(1500100010, '羿彦昌', 23, '男', '理科六班', datetime.datetime(2021, 10, 19, 16, 48, 40))\n"
     ]
    }
   ],
   "source": [
    "for stu in cursor.fetchall():\n",
    "    print(stu)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "81a0652d",
   "metadata": {},
   "outputs": [],
   "source": [
    "stuDF = pd.read_sql('select * from student',con=conn)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "2047aa33",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "      <th>last_mod</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>25</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           id name  age gender clazz            last_mod\n",
       "0  1500100001  施笑槐   22      女  文科六班 2021-10-19 16:48:40\n",
       "1  1500100002  吕金鹏   24      男  文科六班 2021-10-19 16:48:40\n",
       "2  1500100003  单乐蕊   22      女  理科六班 2021-10-19 16:48:40\n",
       "3  1500100004  葛德曜   25      男  理科三班 2021-10-19 16:48:40\n",
       "4  1500100005  宣谷芹   22      女  理科五班 2021-10-19 16:48:40"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "a2246a35",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "      <th>last_mod</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>符瑞渊</td>\n",
       "      <td>26</td>\n",
       "      <td>男</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>25</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>815</th>\n",
       "      <td>1500100816</td>\n",
       "      <td>王瀚钰</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>282</th>\n",
       "      <td>1500100283</td>\n",
       "      <td>侯千风</td>\n",
       "      <td>24</td>\n",
       "      <td>女</td>\n",
       "      <td>文科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>278</th>\n",
       "      <td>1500100279</td>\n",
       "      <td>蔚盼曼</td>\n",
       "      <td>24</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>830</th>\n",
       "      <td>1500100831</td>\n",
       "      <td>宦芷容</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>831</th>\n",
       "      <td>1500100832</td>\n",
       "      <td>蓟芷梦</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>文科四班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>832</th>\n",
       "      <td>1500100833</td>\n",
       "      <td>赖香巧</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>文科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>833</th>\n",
       "      <td>1500100834</td>\n",
       "      <td>谷念薇</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>理科二班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>602</th>\n",
       "      <td>1500100603</td>\n",
       "      <td>鲁盼菡</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name  age gender clazz            last_mod\n",
       "999  1500101000  符瑞渊   26      男  理科六班 2021-10-19 16:48:41\n",
       "3    1500100004  葛德曜   25      男  理科三班 2021-10-19 16:48:40\n",
       "815  1500100816  王瀚钰   24      男  文科六班 2021-10-19 16:48:40\n",
       "282  1500100283  侯千风   24      女  文科三班 2021-10-19 16:48:40\n",
       "278  1500100279  蔚盼曼   24      女  文科六班 2021-10-19 16:48:40\n",
       "..          ...  ...  ...    ...   ...                 ...\n",
       "830  1500100831  宦芷容   21      女  理科六班 2021-10-19 16:48:40\n",
       "831  1500100832  蓟芷梦   21      女  文科四班 2021-10-19 16:48:40\n",
       "832  1500100833  赖香巧   21      女  文科三班 2021-10-19 16:48:40\n",
       "833  1500100834  谷念薇   21      女  理科二班 2021-10-19 16:48:40\n",
       "602  1500100603  鲁盼菡   21      女  理科五班 2021-10-19 16:48:40\n",
       "\n",
       "[1000 rows x 6 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.sort_values('age',ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "b495d2e3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.series.Series"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(stuDF.groupby('clazz')['id'].count())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "9d14ee2c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "clazz\n",
       "文科一班     72\n",
       "文科三班     94\n",
       "文科二班     87\n",
       "文科五班     84\n",
       "文科六班    104\n",
       "文科四班     81\n",
       "理科一班     78\n",
       "理科三班     68\n",
       "理科二班     79\n",
       "理科五班     70\n",
       "理科六班     92\n",
       "理科四班     91\n",
       "Name: id, dtype: int64"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.groupby('clazz')['id'].count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "365a2927",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>clazz</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>文科一班</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>文科三班</td>\n",
       "      <td>94</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>文科二班</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>文科五班</td>\n",
       "      <td>84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>文科六班</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>文科四班</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>理科一班</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>理科三班</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>理科二班</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>理科五班</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>理科六班</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>理科四班</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   clazz  cnt\n",
       "0   文科一班   72\n",
       "1   文科三班   94\n",
       "2   文科二班   87\n",
       "3   文科五班   84\n",
       "4   文科六班  104\n",
       "5   文科四班   81\n",
       "6   理科一班   78\n",
       "7   理科三班   68\n",
       "8   理科二班   79\n",
       "9   理科五班   70\n",
       "10  理科六班   92\n",
       "11  理科四班   91"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.groupby('clazz')['id'].count().reset_index().rename(columns={'id':'cnt'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "6dd82c98",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>clazz</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>文科一班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>文科三班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>文科二班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>文科五班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>文科六班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>文科四班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>理科一班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>理科三班</td>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>理科二班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>理科五班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>理科六班</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>理科四班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   clazz  age\n",
       "0   文科一班   24\n",
       "1   文科三班   24\n",
       "2   文科二班   24\n",
       "3   文科五班   24\n",
       "4   文科六班   24\n",
       "5   文科四班   24\n",
       "6   理科一班   24\n",
       "7   理科三班   25\n",
       "8   理科二班   24\n",
       "9   理科五班   24\n",
       "10  理科六班   26\n",
       "11  理科四班   24"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.groupby('clazz')['age'].max().reset_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "a21267a4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.series.Series"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(stuDF.groupby(['clazz','gender'])['age'].min())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "4a5f4280",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>clazz</th>\n",
       "      <th>gender</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>文科一班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>文科一班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>文科三班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>文科三班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>文科二班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>文科二班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>文科五班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>文科五班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>文科六班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>文科六班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>文科四班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>文科四班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>理科一班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>理科一班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>理科三班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>理科三班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>理科二班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>理科二班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>理科五班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>理科五班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>理科六班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>理科六班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>理科四班</td>\n",
       "      <td>女</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>理科四班</td>\n",
       "      <td>男</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   clazz gender  age\n",
       "0   文科一班      女   21\n",
       "1   文科一班      男   21\n",
       "2   文科三班      女   21\n",
       "3   文科三班      男   21\n",
       "4   文科二班      女   21\n",
       "5   文科二班      男   21\n",
       "6   文科五班      女   21\n",
       "7   文科五班      男   21\n",
       "8   文科六班      女   21\n",
       "9   文科六班      男   21\n",
       "10  文科四班      女   21\n",
       "11  文科四班      男   21\n",
       "12  理科一班      女   21\n",
       "13  理科一班      男   21\n",
       "14  理科三班      女   21\n",
       "15  理科三班      男   21\n",
       "16  理科二班      女   21\n",
       "17  理科二班      男   21\n",
       "18  理科五班      女   21\n",
       "19  理科五班      男   21\n",
       "20  理科六班      女   21\n",
       "21  理科六班      男   21\n",
       "22  理科四班      女   21\n",
       "23  理科四班      男   21"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.groupby(['clazz','gender'])['age'].agg('min').reset_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "08baafc1",
   "metadata": {},
   "outputs": [],
   "source": [
    "scoreDF = pd.read_sql(\"select * from score\",con=conn)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "06499a52",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>student_id</th>\n",
       "      <th>cource_id</th>\n",
       "      <th>score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000001</td>\n",
       "      <td>98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000002</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000003</td>\n",
       "      <td>137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000004</td>\n",
       "      <td>29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000005</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   student_id cource_id  score\n",
       "0  1500100001   1000001     98\n",
       "1  1500100001   1000002      5\n",
       "2  1500100001   1000003    137\n",
       "3  1500100001   1000004     29\n",
       "4  1500100001   1000005     85"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "scoreDF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "54843820",
   "metadata": {},
   "outputs": [],
   "source": [
    "sumDF = scoreDF.groupby('student_id')['score'].sum().reset_index().rename(columns={'score':'sum_score'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "c962e9c0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>student_id</th>\n",
       "      <th>sum_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>395</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   student_id  sum_score\n",
       "0  1500100001        406\n",
       "1  1500100002        440\n",
       "2  1500100003        359\n",
       "3  1500100004        421\n",
       "4  1500100005        395"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sumDF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "5151ad2d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "      <th>last_mod</th>\n",
       "      <th>student_id</th>\n",
       "      <th>sum_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>1500100001</td>\n",
       "      <td>406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>1500100002</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>1500100003</td>\n",
       "      <td>359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>25</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>1500100004</td>\n",
       "      <td>421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>1500100005</td>\n",
       "      <td>395</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>1500100996</td>\n",
       "      <td>厉运凡</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科三班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>1500100996</td>\n",
       "      <td>355</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>1500100997</td>\n",
       "      <td>陶敬曦</td>\n",
       "      <td>21</td>\n",
       "      <td>男</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>1500100997</td>\n",
       "      <td>293</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>1500100998</td>\n",
       "      <td>容昆宇</td>\n",
       "      <td>22</td>\n",
       "      <td>男</td>\n",
       "      <td>理科四班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>1500100998</td>\n",
       "      <td>398</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>钟绮晴</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科五班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>1500100999</td>\n",
       "      <td>371</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>符瑞渊</td>\n",
       "      <td>26</td>\n",
       "      <td>男</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>1500101000</td>\n",
       "      <td>379</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name  age gender clazz            last_mod  student_id  \\\n",
       "0    1500100001  施笑槐   22      女  文科六班 2021-10-19 16:48:40  1500100001   \n",
       "1    1500100002  吕金鹏   24      男  文科六班 2021-10-19 16:48:40  1500100002   \n",
       "2    1500100003  单乐蕊   22      女  理科六班 2021-10-19 16:48:40  1500100003   \n",
       "3    1500100004  葛德曜   25      男  理科三班 2021-10-19 16:48:40  1500100004   \n",
       "4    1500100005  宣谷芹   22      女  理科五班 2021-10-19 16:48:40  1500100005   \n",
       "..          ...  ...  ...    ...   ...                 ...         ...   \n",
       "995  1500100996  厉运凡   24      男  文科三班 2021-10-19 16:48:41  1500100996   \n",
       "996  1500100997  陶敬曦   21      男  理科六班 2021-10-19 16:48:41  1500100997   \n",
       "997  1500100998  容昆宇   22      男  理科四班 2021-10-19 16:48:41  1500100998   \n",
       "998  1500100999  钟绮晴   23      女  文科五班 2021-10-19 16:48:41  1500100999   \n",
       "999  1500101000  符瑞渊   26      男  理科六班 2021-10-19 16:48:41  1500101000   \n",
       "\n",
       "     sum_score  \n",
       "0          406  \n",
       "1          440  \n",
       "2          359  \n",
       "3          421  \n",
       "4          395  \n",
       "..         ...  \n",
       "995        355  \n",
       "996        293  \n",
       "997        398  \n",
       "998        371  \n",
       "999        379  \n",
       "\n",
       "[1000 rows x 8 columns]"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stuDF.merge(sumDF,left_on='id',right_on='student_id',how='outer')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "b7c4fad9",
   "metadata": {},
   "outputs": [],
   "source": [
    "sumDF = sumDF.rename(columns={'student_id':'id'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "id": "d0027de0",
   "metadata": {},
   "outputs": [],
   "source": [
    "joinDF = stuDF.merge(sumDF,on='id')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "b7a84d0d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "      <th>last_mod</th>\n",
       "      <th>sum_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>25</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>395</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           id name  age gender clazz            last_mod  sum_score\n",
       "0  1500100001  施笑槐   22      女  文科六班 2021-10-19 16:48:40        406\n",
       "1  1500100002  吕金鹏   24      男  文科六班 2021-10-19 16:48:40        440\n",
       "2  1500100003  单乐蕊   22      女  理科六班 2021-10-19 16:48:40        359\n",
       "3  1500100004  葛德曜   25      男  理科三班 2021-10-19 16:48:40        421\n",
       "4  1500100005  宣谷芹   22      女  理科五班 2021-10-19 16:48:40        395"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "joinDF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "1655d2e1",
   "metadata": {},
   "outputs": [],
   "source": [
    "joinDF['rank'] = joinDF.groupby('clazz')['sum_score'].rank(method=\"first\", ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "ed494d65",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "      <th>last_mod</th>\n",
       "      <th>sum_score</th>\n",
       "      <th>rank</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>406</td>\n",
       "      <td>39.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>440</td>\n",
       "      <td>24.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>359</td>\n",
       "      <td>47.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>25</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>421</td>\n",
       "      <td>20.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>395</td>\n",
       "      <td>34.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           id name  age gender clazz            last_mod  sum_score  rank\n",
       "0  1500100001  施笑槐   22      女  文科六班 2021-10-19 16:48:40        406  39.0\n",
       "1  1500100002  吕金鹏   24      男  文科六班 2021-10-19 16:48:40        440  24.0\n",
       "2  1500100003  单乐蕊   22      女  理科六班 2021-10-19 16:48:40        359  47.0\n",
       "3  1500100004  葛德曜   25      男  理科三班 2021-10-19 16:48:40        421  20.0\n",
       "4  1500100005  宣谷芹   22      女  理科五班 2021-10-19 16:48:40        395  34.0"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "joinDF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "d2d6053d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "      <th>last_mod</th>\n",
       "      <th>sum_score</th>\n",
       "      <th>rank</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>307</th>\n",
       "      <td>1500100308</td>\n",
       "      <td>黄初夏</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>628</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>874</th>\n",
       "      <td>1500100875</td>\n",
       "      <td>马向南</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>595</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>942</th>\n",
       "      <td>1500100943</td>\n",
       "      <td>许昌黎</td>\n",
       "      <td>21</td>\n",
       "      <td>男</td>\n",
       "      <td>文科一班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>580</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>159</th>\n",
       "      <td>1500100160</td>\n",
       "      <td>云冰真</td>\n",
       "      <td>24</td>\n",
       "      <td>女</td>\n",
       "      <td>文科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>568</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>433</th>\n",
       "      <td>1500100434</td>\n",
       "      <td>黎雨珍</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>550</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>571</th>\n",
       "      <td>1500100572</td>\n",
       "      <td>臧忆香</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>550</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>417</th>\n",
       "      <td>1500100418</td>\n",
       "      <td>蓟海昌</td>\n",
       "      <td>22</td>\n",
       "      <td>男</td>\n",
       "      <td>文科二班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>611</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>822</th>\n",
       "      <td>1500100823</td>\n",
       "      <td>宓新曦</td>\n",
       "      <td>22</td>\n",
       "      <td>男</td>\n",
       "      <td>文科二班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>547</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>953</th>\n",
       "      <td>1500100954</td>\n",
       "      <td>咸芷天</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>文科二班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>533</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>929</th>\n",
       "      <td>1500100930</td>\n",
       "      <td>闻运凯</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科五班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>589</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>948</th>\n",
       "      <td>1500100949</td>\n",
       "      <td>颜沛槐</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>文科五班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>564</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>903</th>\n",
       "      <td>1500100904</td>\n",
       "      <td>阎元蝶</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科五班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>562</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>135</th>\n",
       "      <td>1500100136</td>\n",
       "      <td>黎昆鹏</td>\n",
       "      <td>22</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>583</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>899</th>\n",
       "      <td>1500100900</td>\n",
       "      <td>查思菱</td>\n",
       "      <td>24</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>562</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>715</th>\n",
       "      <td>1500100716</td>\n",
       "      <td>丰冷霜</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>560</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>872</th>\n",
       "      <td>1500100873</td>\n",
       "      <td>路鸿志</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科四班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>612</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257</th>\n",
       "      <td>1500100258</td>\n",
       "      <td>湛昌勋</td>\n",
       "      <td>22</td>\n",
       "      <td>男</td>\n",
       "      <td>文科四班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>604</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>115</th>\n",
       "      <td>1500100116</td>\n",
       "      <td>文元蝶</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>文科四班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>520</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>234</th>\n",
       "      <td>1500100235</td>\n",
       "      <td>沈香巧</td>\n",
       "      <td>24</td>\n",
       "      <td>女</td>\n",
       "      <td>理科一班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>520</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>772</th>\n",
       "      <td>1500100773</td>\n",
       "      <td>傅元蝶</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>理科一班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>492</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>924</th>\n",
       "      <td>1500100925</td>\n",
       "      <td>卞乐萱</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>理科一班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>486</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>928</th>\n",
       "      <td>1500100929</td>\n",
       "      <td>满慕易</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>630</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>183</th>\n",
       "      <td>1500100184</td>\n",
       "      <td>夔寻巧</td>\n",
       "      <td>24</td>\n",
       "      <td>女</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>580</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>597</th>\n",
       "      <td>1500100598</td>\n",
       "      <td>宰金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>551</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>833</th>\n",
       "      <td>1500100834</td>\n",
       "      <td>谷念薇</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>理科二班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>586</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103</th>\n",
       "      <td>1500100104</td>\n",
       "      <td>咸冰蝶</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>理科二班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>533</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>761</th>\n",
       "      <td>1500100762</td>\n",
       "      <td>聂德明</td>\n",
       "      <td>23</td>\n",
       "      <td>男</td>\n",
       "      <td>理科二班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>524</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79</th>\n",
       "      <td>1500100080</td>\n",
       "      <td>巫景彰</td>\n",
       "      <td>21</td>\n",
       "      <td>男</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>628</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>546</th>\n",
       "      <td>1500100547</td>\n",
       "      <td>廖向南</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>584</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>838</th>\n",
       "      <td>1500100839</td>\n",
       "      <td>明雁桃</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>557</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>595</th>\n",
       "      <td>1500100596</td>\n",
       "      <td>田晨潍</td>\n",
       "      <td>21</td>\n",
       "      <td>男</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>587</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>902</th>\n",
       "      <td>1500100903</td>\n",
       "      <td>於依云</td>\n",
       "      <td>24</td>\n",
       "      <td>女</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>549</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>562</th>\n",
       "      <td>1500100563</td>\n",
       "      <td>禄昆鹏</td>\n",
       "      <td>22</td>\n",
       "      <td>男</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>536</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>634</th>\n",
       "      <td>1500100635</td>\n",
       "      <td>蓬怀绿</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>理科四班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>534</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>589</th>\n",
       "      <td>1500100590</td>\n",
       "      <td>逄中震</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科四班</td>\n",
       "      <td>2021-10-19 16:48:40</td>\n",
       "      <td>530</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>938</th>\n",
       "      <td>1500100939</td>\n",
       "      <td>耿智杰</td>\n",
       "      <td>23</td>\n",
       "      <td>男</td>\n",
       "      <td>理科四班</td>\n",
       "      <td>2021-10-19 16:48:41</td>\n",
       "      <td>530</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name  age gender clazz            last_mod  sum_score  rank\n",
       "307  1500100308  黄初夏   23      女  文科一班 2021-10-19 16:48:40        628   1.0\n",
       "874  1500100875  马向南   21      女  文科一班 2021-10-19 16:48:40        595   2.0\n",
       "942  1500100943  许昌黎   21      男  文科一班 2021-10-19 16:48:41        580   3.0\n",
       "159  1500100160  云冰真   24      女  文科三班 2021-10-19 16:48:40        568   1.0\n",
       "433  1500100434  黎雨珍   23      女  文科三班 2021-10-19 16:48:40        550   2.0\n",
       "571  1500100572  臧忆香   23      女  文科三班 2021-10-19 16:48:40        550   3.0\n",
       "417  1500100418  蓟海昌   22      男  文科二班 2021-10-19 16:48:40        611   1.0\n",
       "822  1500100823  宓新曦   22      男  文科二班 2021-10-19 16:48:40        547   2.0\n",
       "953  1500100954  咸芷天   21      女  文科二班 2021-10-19 16:48:41        533   3.0\n",
       "929  1500100930  闻运凯   24      男  文科五班 2021-10-19 16:48:41        589   1.0\n",
       "948  1500100949  颜沛槐   21      女  文科五班 2021-10-19 16:48:41        564   2.0\n",
       "903  1500100904  阎元蝶   23      女  文科五班 2021-10-19 16:48:41        562   3.0\n",
       "135  1500100136  黎昆鹏   22      男  文科六班 2021-10-19 16:48:40        583   1.0\n",
       "899  1500100900  查思菱   24      女  文科六班 2021-10-19 16:48:40        562   2.0\n",
       "715  1500100716  丰冷霜   22      女  文科六班 2021-10-19 16:48:40        560   3.0\n",
       "872  1500100873  路鸿志   24      男  文科四班 2021-10-19 16:48:40        612   1.0\n",
       "257  1500100258  湛昌勋   22      男  文科四班 2021-10-19 16:48:40        604   2.0\n",
       "115  1500100116  文元蝶   21      女  文科四班 2021-10-19 16:48:40        520   3.0\n",
       "234  1500100235  沈香巧   24      女  理科一班 2021-10-19 16:48:40        520   1.0\n",
       "772  1500100773  傅元蝶   21      女  理科一班 2021-10-19 16:48:40        492   2.0\n",
       "924  1500100925  卞乐萱   21      女  理科一班 2021-10-19 16:48:41        486   3.0\n",
       "928  1500100929  满慕易   21      女  理科三班 2021-10-19 16:48:41        630   1.0\n",
       "183  1500100184  夔寻巧   24      女  理科三班 2021-10-19 16:48:40        580   2.0\n",
       "597  1500100598  宰金鹏   24      男  理科三班 2021-10-19 16:48:40        551   3.0\n",
       "833  1500100834  谷念薇   21      女  理科二班 2021-10-19 16:48:40        586   1.0\n",
       "103  1500100104  咸冰蝶   23      女  理科二班 2021-10-19 16:48:40        533   2.0\n",
       "761  1500100762  聂德明   23      男  理科二班 2021-10-19 16:48:40        524   3.0\n",
       "79   1500100080  巫景彰   21      男  理科五班 2021-10-19 16:48:40        628   1.0\n",
       "546  1500100547  廖向南   22      女  理科五班 2021-10-19 16:48:40        584   2.0\n",
       "838  1500100839  明雁桃   22      女  理科五班 2021-10-19 16:48:40        557   3.0\n",
       "595  1500100596  田晨潍   21      男  理科六班 2021-10-19 16:48:40        587   1.0\n",
       "902  1500100903  於依云   24      女  理科六班 2021-10-19 16:48:41        549   2.0\n",
       "562  1500100563  禄昆鹏   22      男  理科六班 2021-10-19 16:48:40        536   3.0\n",
       "634  1500100635  蓬怀绿   23      女  理科四班 2021-10-19 16:48:40        534   1.0\n",
       "589  1500100590  逄中震   24      男  理科四班 2021-10-19 16:48:40        530   2.0\n",
       "938  1500100939  耿智杰   23      男  理科四班 2021-10-19 16:48:41        530   3.0"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "joinDF[joinDF['rank'] <= 3].sort_values(['clazz','rank'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "5f76f819",
   "metadata": {},
   "outputs": [],
   "source": [
    "clazzNumDF = stuDF.groupby('clazz')['id'].count().reset_index().rename(columns={'id':'cnt'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "c87a48e2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>clazz</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>文科一班</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>文科三班</td>\n",
       "      <td>94</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>文科二班</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>文科五班</td>\n",
       "      <td>84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>文科六班</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>文科四班</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>理科一班</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>理科三班</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>理科二班</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>理科五班</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>理科六班</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>理科四班</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   clazz  cnt\n",
       "0   文科一班   72\n",
       "1   文科三班   94\n",
       "2   文科二班   87\n",
       "3   文科五班   84\n",
       "4   文科六班  104\n",
       "5   文科四班   81\n",
       "6   理科一班   78\n",
       "7   理科三班   68\n",
       "8   理科二班   79\n",
       "9   理科五班   70\n",
       "10  理科六班   92\n",
       "11  理科四班   91"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "clazzNumDF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "538265dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "id": "9b2e2353",
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.rcParams['font.sans-serif'] = ['SimHei']  # 解决中文显示问题-设置字体为黑体\n",
    "plt.rcParams['axes.unicode_minus'] = False  # 解决保存图像是负号'-'显示为方块的问题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "id": "abe901a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:title={'center':'班级人数'}, xlabel='clazz', ylabel='cnt'>"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAz0AAAHtCAYAAAAzyRBzAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAfXUlEQVR4nO3de5RlZ1kn4N9LdyeEJEAwPcEIsRUiGMRwaSDGAE1I5KoCRokiIJcVFBxAxwtKvKDLkQEGUUEgGhgUGMggoFyMIiGSiBE7IqgsvDEBDBNtMJAAAbm888c+bdqmOnSSc6n66nnWqtW79j519nveOnW+/p1vn72ruwMAADCqm6y6AAAAgEUSegAAgKEJPQAAwNCEHgAAYGhCDwAAMDShBwAAGJrQA8BSVdUtr2PbaVV13A2836dX1Xdcx/YfrqqbVtUFVXXnqvrxqrp5Vb2kqu5zQ/YJwMawddUFADCmqjoyyV2TfCnTePO+7v63JG+qqpc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18Xfdir1rio5qxHN7k+v9/ruU890AM9yJg92Khjw15z6sG6HReGDT0AAADJ5jhlNQAAsIkJPQAAwNCEHgDWtaq6cNU1ALCxCT0AAMDQhB4A1oWqumlVvaaqLq6qN1fVzda4zRFV9daquqCqXj5bd2pVXTj7+lxVHbvWuuU/IgDWi2Gv0wPAhnNWkvd295lV9bgk35Tpgnn7+uokL0ryx5kugHdMd1+Q5IKqemKSS7v7o0k+usY6ADYpoQeA9eKOSX53tvy/DnCbzyd5YpLHJblVksOS/7jw6plJHrj3hmutA2BzcngbAOvFB5LcY7b805nCzf6ekOR1Sb43yaeTpKpukeTFSR6794rwa60DYPMSegBYL85JcrfZ2druluR31rjN25L8VJILZt9/TZInJ7lNklfNPsNz3wOsA2CTqu5edQ0AAAALY6YHAAAYmtADAAAMTegBAACGJvQAAABDE3oAAIChCT0AAMDQhB4AAGBo/x8zbSDmSvjXhQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 1008x576 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(14,8))\n",
    "plt.title(\"班级人数\")\n",
    "sns.barplot(x=\"clazz\", y=\"cnt\", data=clazzNumDF)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "id": "0f826e40",
   "metadata": {},
   "outputs": [],
   "source": [
    "gender_grp = stuDF.groupby('gender')['id'].count().reset_index().rename(columns={'id':'cnt'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "id": "95842ef7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>gender</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>女</td>\n",
       "      <td>493</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>男</td>\n",
       "      <td>507</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  gender  cnt\n",
       "0      女  493\n",
       "1      男  507"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gender_grp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "id": "60cb8f8e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXMAAAD4CAYAAAAeugY9AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAPO0lEQVR4nO3dXYxdV3nG8f+DY2pjG5w4E1M3gIFaQYlah9aY4DrGhFgQvipIE6KCU1MiCymA1IvSUCKk5sKmhkLTigS5+ShK0lKTNhEImgpiyAcmkDGxVLUNohemTFBgsIKNi6xQ9PbiHGPjzOCZM/uM7eX/72b2Wfvs/a4ZzTxn7bU/JlWFJOnU9qwT3QFJ0swZ5pLUAMNckhpgmEtSAwxzSWrAGSei6Nlnn13Lly8/EaUl6ZS1e/fuH1XVyETrTkiYL1++nNHR0RNRWpJOWUm+O9k6p1kkqQGGuSQ1wDCXpAackDlzSRqGn/3sZ4yNjXHo0KET3ZU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k/qp6EHgQIMlGeqP0zlXVD4CNSV4D3Jvkk8AwRzwvTbIVOCfJ0n79C4ZVrKquTXIxveuFl/enkF5K72hrGNKv+33gQ0lC72/hdfTu8+jSwSRX0XuG0ookC4HfBv6n4zqH/STJK4DH6B0BfBTYA/zpkOoBXDPBQJEkf03vZ9rpQBH4ILANuLyqhvI3d1JPswAkeSuwnt7zXw7SC6Z7u/7kPKreYuD/qurgMPZ/VJ3nAu+oqpuPapsLvLuqPjWEes+nN+K6/6i2DwDbq+rHXdc7pvZc4Drg0sMjsCHUmEMvcC4Cvgn8O3AHcENV/ccwavbrngFcTe/o5zvAbcP43UnynmH8XkxSazGwEdgHPAxsoTeQ+khVPTqEesuBvwRWAHdX1Zaua0xQ8/PAozxzoPgX9H5PO79XJslLgANVNZQHep30YS5JXet/CL+PZw4UP11VwzoCGSrDXJKGbDbOxxnmkk47s3yxA0mWMuTzcYa5pNPObITrBDUXM8TzcYa5pNPSbF3sMFsMc0lqwEl/O78k6fgMc0lqgGEuSQ0wzCWpAf8PPzoYd2Vjh3cAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "clazzNumDF.plot.bar()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "id": "18ca4cd5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOcAAADnCAYAAADl9EEgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAZKElEQVR4nO3de5hU1Znv8e+uS3d1NViggCAgWzSPoiQYCHp0iMZMok9sEy+ZRFEhOsRjEp9jPMRLxWSSPYzjlJqMgclxNIfJZE5GNJGIUbcmPBMVBUEUnY6tokG7uKj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TSAH3YDmBXK2/3CScQ2EljgO+h7tvi/Skh7YX+AmwpLRTnBggCedwWImxwP8CrkUuv3xUGrgP+Ndau+2uXCSc5WAl6oFLcYP6Gc3V6FQE/gjcAzzh5wWdvUDCWW5WYjZuUP8GmKK5mmp5G/gP4D+wnC26iwkKCWclWYnTgK+VHkELaivwJPAglvOc7mKCSMJZLW6P+jXcvV38uPFvFliFO9XuSSznTc31BJ6EUwcrMQk4s/Q4A/g0ENVa08cp3JUHVuIG8mks5+MbtIiKkXB6gZWI4Q4k7Q/rp4DJVC+we4FXgT/3ebT4fSMgv5NwepW7MPYxuO9VzdK/fR8JIF56HCzEWWA3sOsgj3eAV7GcrZX6NsTQSTiDwEqEgTrAwL1f2gAKpf1LhU9JOIXwKJmVIoRHSTiF8CgJpxAeFdFdgDg8wzDuBWbjXvKYgLuUZxoYDbyklLpWX3WiUiSc/pAFvqeUesYwjKuASUqp2wzD+BzuPbwigCSc/vFTwzAO9JylYI4G1uosSlSOhNMfIsC/AS8DTcBY4FfATGC6vrJEJcl1Th8wDGMaMLH04U2407N2lD5+VylV04svB5X0nB5nGEYC+AXuhrHg3oM7AndldHDXfP2ShtJEhUnP6QOGYUSUUnnDMI4EbKXUGX2+9ppSSvZ5CSC5zukDpWBOBpYB/7z/84ZhTMRdalIEkJzWelwplA/gzi65Syn1p9LnzwaWAHdrLE9UkJzW+oBhGPVKqZ6PfC4MhJVSsjBzQEk4hfAoec8phEdJOIXwKAmnEB4l4RTCoyScQniUhFMIj5JwCuFREk4hPErCKYRHSTiF8CgJpxAeJeEUwqMknEJ41P8HlD8Ung6UMM4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.pie(gender_grp['cnt'],labels=gender_grp['gender'],autopct='%.2f%%')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "031059ec",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
